<% layout('/layouts/default.html', {title: 'kg_knowledge管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('kg_knowledge管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<% if(hasPermi('kg:kgKnowledge:edit')){ %>
					<a href="${ctx}/kg/kgKnowledge/form" class="btn btn-default btnTool" title="${text('新增kg_knowledge')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${kgKnowledge}" action="${ctx}/kg/kgKnowledge/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('kg_id')}：</label>
					<div class="control-inline">
						<#form:input path="kgId" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('name')}：</label>
					<div class="control-inline">
						<#form:input path="name" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('标签')}：</label>
					<div class="control-inline">
						<#form:input path="tag" maxlength="200" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('content')}：</label>
					<div class="control-inline">
						<#form:input path="content" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('type')}：</label>
					<div class="control-inline">
						<#form:input path="type" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('kg_name')}：</label>
					<div class="control-inline">
						<#form:input path="kgName" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('首页图片')}：</label>
					<div class="control-inline">
						<#form:input path="picture" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('收藏')}：</label>
					<div class="control-inline">
						<#form:input path="coll" maxlength="11" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('点击率')}：</label>
					<div class="control-inline">
						<#form:input path="hit" maxlength="11" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('状态')}：</label>
					<div class="control-inline width-120">
						<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('注意事项')}：</label>
					<div class="control-inline">
						<#form:input path="note" maxlength="100" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("kg_id")}', name:'kgId', index:'a.kg_id', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/kg/kgKnowledge/form?id='+row.id+'" class="btnList" data-title="${text("编辑kg_knowledge")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("name")}', name:'name', index:'a.name', width:150, align:"left"},
		{header:'${text("标签")}', name:'tag', index:'a.tag', width:150, align:"left"},
		{header:'${text("content")}', name:'content', index:'a.content', width:150, align:"left"},
		{header:'${text("type")}', name:'type', index:'a.type', width:150, align:"left"},
		{header:'${text("kg_name")}', name:'kgName', index:'a.kg_name', width:150, align:"left"},
		{header:'${text("首页图片")}', name:'picture', index:'a.picture', width:150, align:"left"},
		{header:'${text("收藏")}', name:'coll', index:'a.coll', width:150, align:"center"},
		{header:'${text("点击率")}', name:'hit', index:'a.hit', width:150, align:"center"},
		{header:'${text("状态")}', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '${text("未知")}', true);
		}},
		{header:'${text("注意事项")}', name:'note', index:'a.note', width:150, align:"left"},
		{header:'${text("操作")}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('kg:kgKnowledge:edit')){ %>
				actions.push('<a href="${ctx}/kg/kgKnowledge/form?id='+row.id+'" class="btnList" title="${text("编辑kg_knowledge")}"><i class="fa fa-pencil"></i></a>&nbsp;');
				if (row.status == Global.STATUS_NORMAL){
					actions.push('<a href="${ctx}/kg/kgKnowledge/disable?id='+row.id+'" class="btnList" title="${text("停用kg_knowledge")}" data-confirm="${text("确认要停用该kg_knowledge吗？")}"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
				}
				if (row.status == Global.STATUS_DISABLE){
					actions.push('<a href="${ctx}/kg/kgKnowledge/enable?id='+row.id+'" class="btnList" title="${text("启用kg_knowledge")}" data-confirm="${text("确认要启用该kg_knowledge吗？")}"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
				}
				actions.push('<a href="${ctx}/kg/kgKnowledge/delete?id='+row.id+'" class="btnList" title="${text("删除kg_knowledge")}" data-confirm="${text("确认要删除该kg_knowledge吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>